import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/content/home";
import About from "../views/content/about";
import CreateBlog from "../views/content/createBlog";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: About,
    meta: {
      title: "关于",
    },
  },
  {
    path: "/works",
    name: "Works",
    component: () => import("../views/content/works"),
    meta: {
      title: "作品",
    },
  },
  {
    path: "/blog",
    name: "blog",
    component: () => import("../views/blog"),
    meta: {
      title: "博客",
    },
  },
  {
    path: "/contact",
    name: "Contact",
    component: () => import("@/views/content/contact"),
    meta: {
      title: "联系我",
    },
  },
  {
    path: "/detail",
    name: "Detail",
    component: () => import("@/views/blog/detail"),
    meta: {
      title: "详情",
    },
  },
  // 写博客
  {
    path: "/x",
    name: "CreateBlog",
    component: CreateBlog,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
